import React from "react";
import {ColumnsType} from "antd/es/table";
import {OutboundDeliveryOrder} from "type/OutboundDeliveryOrder";
import {ellipsisHandler} from "../util/ColumnsUtil";
import OdoHandler from "../component/drp/OdoHandler";
import {Link} from "react-router-dom";

const ODO_NUMBER_PREFIX: string = "ODO-" ;

const outboundDeliveryOrderColumns: ColumnsType<OutboundDeliveryOrder> = [
    {
        title: '序号' ,
        dataIndex: 'index',
        width: 60,
        align: "center" ,
        render: (_, __, index) => <strong>{index + 1}</strong>
    },
    {
        title: '出库单号',
        dataIndex: 'id',
        key: 'id',
        width: 145,
        align: "center" ,
        render: (value,record) => <Link to={"details"} state={record}>{ODO_NUMBER_PREFIX + value}</Link>
    },
    {
        title: '零件名称',
        dataIndex: 'partName',
        key: 'partName',
        width: 180,
        align: "center" ,
        fixed: "left",
    },
    {
        title: '零件图号',
        dataIndex: 'partFigureNumber',
        key: 'partFigureNumber',
        width: 160,
        ellipsis: {showTitle: false},
        fixed: "left",
        render: ellipsisHandler
    },
    {
        title: '零件编号',
        dataIndex: 'partSerialNumber',
        key: 'partSerialNumber',
        width: 110,
        ellipsis: {showTitle: false},
        render: ellipsisHandler
    },
    {
        title: '出库类型',
        dataIndex: 'odoType',
        key: 'odoType',
        width: 110,
        align: "center" ,
        render: OdoHandler.getInstance().odoTypeRender
    },
    {
        title: '出库流向',
        dataIndex: 'odoFlow',
        key: 'odoFlow',
        align: "center" ,
        width: 200
    },
    {
        title: '出库描述',
        dataIndex: 'odoDesc',
        key: 'odoDesc',
        width: 110,
        ellipsis: {showTitle: false},
        render: ellipsisHandler
    },
    {
        title: '出库数量',
        dataIndex: 'odoSize',
        key: 'odoSize',
        width: 110,
        align: "center" ,
    },
    {
        title: '出库时间',
        dataIndex: 'odoTime',
        key: 'odoTime',
        width: 160,
        align: "center"
    },
    {
        title: '出库单价',
        dataIndex: 'odoPrice',
        key: 'odoPrice',
        width: 110,
        align: "center" ,
    },
    {
        title: '出库总价',
        dataIndex: 'odoAmount',
        key: 'odoAmount',
        width: 110,
        align: "center" ,
    },
    {
        title: '操作员',
        dataIndex: 'odoOperator',
        key: 'odoOperator',
        width: 130,
        align: "center" ,
    },
    {
        title: '备注信息',
        dataIndex: 'remark',
        key: 'remark',
        width: 110,
        ellipsis: {showTitle: false},
        render: ellipsisHandler
    }
] ;
export default outboundDeliveryOrderColumns;
